package com.qlk.vorder.domain.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by zhaoyanan on 2016/8/5.
 */
public enum SexEnum {

    MALE(1, "男"), FAMALE(0, "女");

    int type;

    String name;

    SexEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    public static String getName(int type) {
        for (SexEnum ele : SexEnum.values()) {
            if (ele.getType() == type)
                return ele.getName();
        }
        return null;
    }

    public static Map<Integer, String> getMap() {
        Map<Integer, String> dataMap = new HashMap<Integer, String>();
        for (SexEnum enumObj : SexEnum.values()) {
            dataMap.put(enumObj.getType(), enumObj.getName());
        }
        return dataMap;
    }

    public static List<Map<String, Object>> getList() {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        for (SexEnum ele : SexEnum.values()) {
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("key", ele.getType());
            map.put("value", ele.getName());
            list.add(map);
        }
        return list;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


}
